home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Magazin: Amiga-CD 1996 May & June
/
Amiga-CD 1996 #5-6.iso
/
demos
/
finaldata
/
fdmacros
/
setcolumnwidth
< prev
next >
Wrap
Text File
|
1996-03-22
|
2KB
|
70 lines
/* --------------------------------------------- */
/* Final Data ARexx Macro. */
/* SetColumnWidth: This macro will adjust the */
/* width of each selected column so that when */
/* printed all of the data in the column will */
/* be printed. Be sure to have the print pitch */
/* set before you run this macro. */
/* $VER: SetColumnWidth 1.0 (28.6.94) */
/* */
/* This macro is useful because the font used on */
/* screen is proportional, whereas the printed */
/* font is non-proportional (mono-spaced). This */
/* makes it difficult to know how wide to make */
/* the column so that all the data will get */
/* printed. Without this macro it's all done by */
/* trial and error. */
/* --------------------------------------------- */
OPTIONS RESULTS
SelectionInfo
PARSE VAR RESULT selType fromCol toCol
IF ( selType = 'COLUMNS' ) THEN DO
GetPrintPrefs PITCH DEVICE
PARSE VAR RESULT prefsPitch prefsDevice
pitch = 10
IF ( prefsDevice = 'Printer' ) THEN DO
SELECT
WHEN ( prefsPitch = 'Pica' ) THEN DO
pitch = 10
END
WHEN ( prefsPitch = 'Elite' ) THEN DO
pitch = 12
END
WHEN ( prefsPitch = 'Fine' ) THEN DO
pitch = 15
END
OTHERWISE DO
END
END /* Select */
END
NumRows
nrows = RESULT
IF ( nrows > 0 ) THEN DO
DO c = fromCol TO toCol
GetColumnName POSITION c
maxlen = LENGTH(RESULT)
DO r = 1 TO nrows
CellData c r
len = LENGTH(RESULT)
IF ( len > maxlen ) THEN
maxlen = len
END /* do to nrows */
pixels = ((maxlen * 80) % pitch) + 1
GetColumnID POSITION c
InitModifyColumn RESULT
DefineColumn WIDTH pixels
ModifyColumn
END /* do to toCol */
END
END